#ifndef MSGHEADER_H
#define MSGHEADER_H

#ifndef BUFFERSIZE 
#define BUFFERSIZE 64	//字符串大小
#endif

#ifndef bool
#define bool int	//BOOL类型
#endif



enum MSG		//设备KEY值
{
	MSG_STM32LIGHT, //stm32大厅灯 0
	MSG_AIRHEATING, //空调制热 1
	MSG_AIRDOWN,    //空调制冷 2
	MSG_AIRDEHUM,   //空调除湿 3
	MSG_INDOORTEMP,  //室内温度 4
	MSG_HUMIDITY,    //室内湿度 5
	MSG_INTERIORDOOR,    //向外打开的门 6
	MSG_EXTERIORDOOR,	 //向外打开的门 7
	MSG_MODBUSLIGHT,    //modbus灯 8
	MSG_WINDOW,          //窗 9
	MSG_CURTAIN,     //窗帘 10
	MSG_TV,          //电视 11
	MSG_CLOUDLIGHT,  //云衣柜的灯 12
	MSG_CLOUDHEATING, //云衣柜制热 13
	MSG_CLOUDDEHUM,  //云衣柜除湿 14
	MSG_CLOUDULTRALIGHT, //云衣柜紫外线灯 15
	MSG_CLOUDBUZZER, //云衣柜蜂鸣器 16
	MSG_CLOUDDOOR,   //云衣柜柜门开关 17
	MSG_CLOUDTEMPER,    //云衣柜柜内温度 18
	MSG_CLOUDHUM  //云衣柜柜内湿度 19
};


union values	//数据内容
{
	bool a;
	int b_val;
	float c_val;

};

enum _device_	//设备类型(可以不区分)
{
	DEVICE_SERVER,
	DEVICE_CLIENT,
	DEVICE_IPHONE
};

struct REPORT	//上报策略
{
	int type;   //0-不上报，客户端主动采集；1-变化上报，即连续2次值不相等；2-周期上报
	int period; //上报周期时间，单位秒，仅在type=2时有效
};

struct device_optional		//设备地址和端口号配置
{
	int device;//区分什么设备
	char addr[BUFFERSIZE];
	int port;
};

struct device_modbus	//modbus传输结构体
{
	unsigned int key;
	char name[BUFFERSIZE];
	unsigned int addr;
	unsigned int type;
	union values val;

};

struct device_stm32		//stm32传输结构体
{
	unsigned int key;
	char name[BUFFERSIZE];
	unsigned int type;
	union values val;
};

struct device_cloudwardrobe		//云衣柜传输结构体
{
	unsigned int key;
	char name[BUFFERSIZE];
	unsigned int type;
	union values val;
};

#endif